package com.jlg.beans.page;

import java.net.MalformedURLException;

/**
 * 
 * @author huazhang
 * @since 2011-03-26
 */
public class Outlink
{

    private String toUrl = "";
    private String anchor = "";
    private long fetchInterval = 1000;
    private boolean isPage = true;
    private boolean isParseSucess = true;

    public boolean isPage()
    {
        return isPage;
    }

    public void setPage(boolean isPage)
    {
        this.isPage = isPage;
    }

    public boolean isParseSucess()
    {
        return isParseSucess;
    }

    public void setParseSucess(boolean isParseSucess)
    {
        this.isParseSucess = isParseSucess;
    }

    public Outlink(String toUrl, String anchor)
    {
        if (toUrl == null)
        {
            toUrl = "";
        }
        this.toUrl = toUrl;
        if (anchor == null)
        {
            anchor = "";
        }
        this.anchor = anchor;
    }

    public Outlink(String toUrl, String anchor, boolean isPage)
            throws MalformedURLException
    {
        if (toUrl == null)
            toUrl = "";
        this.toUrl = toUrl;
        if (anchor == null)
            anchor = "";
        this.anchor = anchor;
        this.isPage = isPage;
    }

    public String getToUrl()
    {
        return toUrl;
    }

    public void setToUrl(String url)
    {
        toUrl = url;
    }

    public String getAnchor()
    {
        return anchor;
    }

    public boolean equals(Object o)
    {
        if (!(o instanceof Outlink))
            return false;
        Outlink other = (Outlink) o;
        return this.toUrl.equals(other.toUrl)
                && this.anchor.equals(other.anchor);
    }

    public String toString()
    {
        return "toUrl: " + toUrl + " anchor: " + anchor + "isPage: " + isPage
                + "isParseSucess:" + isParseSucess;
    }

    public long getFetchInterval()
    {
        return fetchInterval;
    }

    public void setFetchInterval(long fetchInterval)
    {
        this.fetchInterval = fetchInterval;
    }

    public void setAnchor(String anchor)
    {
        this.anchor = anchor;
    }

}
